'''
Created on 19.12.2011

@author: cwestphal

selection order: FK-IK-RESULT
'''

import maya.cmds as cmds

sel = cmds.ls (selection = True)

prefix = 'r_b_'

BlendRotate = cmds.shadingNode ('blendColors', asUtility = True)

cmds.connectAttr ('%s.rotate' %(sel[0]), '%s.color1' %(BlendRotate))
cmds.connectAttr ('%s.rotate' %(sel[1]), '%s.color2' %(BlendRotate))
cmds.connectAttr ('%s.output' %(BlendRotate), '%s.rotate' %(sel[2]))

cmds.connectAttr ('%sleg_settings.FK_IK_1' %(prefix), '%s.blender' %(BlendRotate))

BlendTranslate = cmds.shadingNode ('blendColors', asUtility = True)

cmds.connectAttr ('%s.translate' %(sel[0]), '%s.color1' %(BlendTranslate))
cmds.connectAttr ('%s.translate' %(sel[1]), '%s.color2' %(BlendTranslate))
cmds.connectAttr ('%s.output' %(BlendTranslate), '%s.translate' %(sel[2]))

cmds.connectAttr ('%sleg_settings.FK_IK_1' %(prefix), '%s.blender' %(BlendTranslate))

BlendScale = cmds.shadingNode ('blendColors', asUtility = True)

cmds.connectAttr ('%s.scale' %(sel[0]), '%s.color1' %(BlendScale))
cmds.connectAttr ('%s.scale' %(sel[1]), '%s.color2' %(BlendScale))
cmds.connectAttr ('%s.output' %(BlendScale), '%s.scale' %(sel[2]))

cmds.connectAttr ('%sleg_settings.FK_IK_1' %(prefix), '%s.blender' %(BlendScale))